package com.glsc.ngateway.amdoc.config;

import ch.qos.logback.core.PropertyDefinerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.net.InetAddress;

@Component
public class LogIpConfig extends PropertyDefinerBase {

    private Logger logger = LoggerFactory.getLogger(LogIpConfig.class);

    @Override
    public String getPropertyValue() {
        try {
            logger.info("获取ip地址:{}", InetAddress.getLocalHost().getHostAddress());
            return InetAddress.getLocalHost().getHostAddress();
        }catch (Exception e){
            logger.error("获取ip地址异常：",e);
        }
        return null;
    }
}
